/*
 * Copyright 2012 Gayan Perera
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/
package gap.maven.script.components.api;

import java.io.File;

/**
 * The base interface which contain the common apis of {@link ArtifactFile} and {@link POMArtifactFile}.
 * 
 * @author gayan
 */
interface BaseArtifact {

    /**
     * Calling this will download the artifact from the remote repository (resolving)
     * if it doen't exist in the local repository.
     * @return <code>true</code> if the downloading was success and the artifact exist in the local repository.
     */
    boolean download();
    
    /**
     * Returns the {@link File} which represents this artifact.
     * @return file object if the artifact is already downloaded, else null is returned.
     */
    File getFile();
    
    /**
     * Returns the group id of the artifact. Calling this method before calling {@link #download()} will cause an 
     * IllegalStateException to be thrown.
     * 
     * @return the group id of the downloaded artifact.
     */
    String getGroupId();
    
    /**
     * Returns the artifact id of the artifact. Calling this method before calling {@link #download()} will cause an 
     * IllegalStateException to be thrown.
     * 
     * @return the artifact id of the downloaded artifact.
     */
    String getArtifactId();
    
    /**
     * Returns the type of the artifact. Calling this method before calling {@link #download()} will cause an 
     * IllegalStateException to be thrown.
     * 
     * @return the type of the downloaded artifact.
     */
   String getType();
    
   /**
    * Returns the version of the artifact. Calling this method before calling {@link #download()} will cause an 
    * IllegalStateException to be thrown.
    * 
    * @return the version of the downloaded artifact.
    */
    String getVersion();
    
    /**
     * Returns the classifier of the artifact. Calling this method before calling {@link #download()} will cause an 
     * IllegalStateException to be thrown.
     * 
     * @return the classifier of the downloaded artifact.
     */
    String getClassifier();
}
